﻿<%@ Page Title="Create User Page" Language="C#" MasterPageFile="  ~/Template/Site.Master" AutoEventWireup="true" CodeBehind="SearchProduct.aspx.cs" Inherits="EAClient.SearchProduct" %>

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <style type="text/css">

    .alert_search {
        float:left;
        border:1px solid #CCC;
        background-color:#EBEBEB;
        width:99%;
        padding-top:5px;
        color:#494949;
        margin-bottom:5px;
    }

        .alert_search .title {
            
            font-size:14px;
            float:left;
        }

        .alert_search .control {
            
            font-size:12px;
            float:right;
        }
</style>
    <div class="alert_search">
        <div class="title"><a style='color:orange;font-weight:bold;padding-left:10px'><%=Attributes["totalResult"] %></a> Results found by keyword "<b><%=Request["keyword"] %></b>"</div>
        <%int total = (Int32)Attributes["totalResult"];
                              int totalView = EA.Common.Constant.TOTAL_RECORD_VIEW;
                              double page=(double)total/(double)totalView;
                              if(page>(int)page)
                              {
                                 page = page + 1;
                              }
         %>
        <div class="control">Page : <select onchange="location.href='/SearchProduct.aspx?keyword=<%=Request["keyword"] %>&page='+this.value;">
            <% 
                                for (int i = 1; i < page; i++)
                                { 
                             %>
                                    <option <%=  (((int)Attributes["page"]) == i ) ? "selected" : "" %> value="<%=i %>">
                                        <%=i %>
                                    </option>
                            <%  
                                }
                            %>



                                    </select></div>

    </div>
        
        <% 
            List<EA.DTO.ProductTO> listProduct = (List<EA.DTO.ProductTO>)Attributes["listProduct"];
            for (int i = 0;  i < listProduct.Count; i++)
            { %>
										<div class="_product">
											<div class="product">
												<div class="image"><a href="DetailProduct.aspx?id=<%=listProduct[i].ID %>"><img src="<%= EAClient.WebPage.PATH_IMAGE+listProduct[i].Url %>"/></a></div>
												<div class="product_name"><a href="DetailProduct.aspx?id=<%=listProduct[i].ID %>"><%=listProduct[i].Name %></a></div>
												<div class="_price">
													<div><img src="Images/like_button.png" alt=""/></div>
													<div class="price"><%=listProduct[i].CurrentPrice %>$</div>
												</div>
											</div>
										</div>
                                        <%} %>
   
</asp:Content>
